/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.helloswing;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.HeadlessException;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;

/**
 *
 * @author winnie
 */
public class TopLevelDemo extends JFrame {

    public TopLevelDemo() throws HeadlessException {
        initComponents();
    }

    private void initComponents() {
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JMenuBar greenMenuBar = new JMenuBar();
        greenMenuBar.setBackground(Color.green);
        greenMenuBar.setOpaque(true);
        greenMenuBar.setPreferredSize(new Dimension(200, 20));
        this.setJMenuBar(greenMenuBar);
        
        
        //2 ways to get the content pane
//        Container contentPane = this.getContentPane();
        JPanel contentPane = new JPanel(new BorderLayout());
        this.setContentPane(contentPane);
        
        JLabel yelloLabel = new JLabel();
        yelloLabel.setToolTipText("Demo Label contained by contentPane");
        yelloLabel.setOpaque(true);
        yelloLabel.setBackground(Color.yellow);
        yelloLabel.setPreferredSize(new Dimension(200, 180));
        contentPane.add(yelloLabel, BorderLayout.CENTER);

        this.pack();
        this.setVisible(true);
    }
    
}
